﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Configuration;

namespace LINQtoLDAPDemo_Console.disable
{
    public class UserMapping : LinqToLdap.Mapping.ClassMap<User>
    {
        // Manual mapping: http://hattercoding.blogspot.com/2011/02/linq-to-ldap-how-does-it-work-part-2.html
        public UserMapping()
        {
            NamingContext(string.Format("CN=Users,{0}", ConfigurationSettings.AppSettings["ldapPartition"]));
            ObjectCategory("user");

            Map(e => e.EmployeeID);
            Map(e => e.LastName).Named("sn");
            Map(e => e.FirstName).Named("givenName");
            Map(e => e.Notes).Named("comment");
            Map(e => e.HomePhone);
            Map(e => e.Title);
            Map(e => e.TitleOfCourtesy).Named("personalTitle");
            Map(e => e.DisplayName);

            //Map(e => e.ReportsTo).Named("manager");            
            //Map(e => e.CN); // throws off Update command when adding management DNs
            DistinguishedName(e => e.DistinguishedName);
            Map(e => e.Manager);
        }
    }
}
